<?php

/*
 * @author Ebrain Cedeno <ebraincedeno@gmail.com>
 */
class TScrolledWidget extends TWidget{
    
    public $VScrolled = true;
    public $HScrolled = true;
    protected $html = '';
    
    public function __construct() {
        parent::__construct(__CLASS__);
        $this->Width = 400;
        $this->Height = 400;
    }
    
    public function add($value){
        $this->html = $value;
    }
    
    public function show(){
        
        if ($this->Visible == true){
            
            if ($this->VScrolled == true && $this->HScrolled == true){
                $scrolled = "overflow:auto";
            }
            elseif ($this->VScrolled == true && $this->HScrolled == false){
                $scrolled = "overflow-x: scroll";
            }
            elseif ($this->VScrolled == false && $this->HScrolled == true){
                $scrolled = "overflow-y: scroll";
            }
            
            if (!array_key_exists('style', $this->OptionsAditional)){
                $this->OptionsAditional['style'] = array('width:'.$this->Width.'px','height:'.$this->Height.'px',$scrolled);
            }
            else{
                $this->OptionsAditional['style'][] = 'width:'.$this->Width.'px';
                $this->OptionsAditional['style'][] = 'height:'.$this->Height.'px';
                $this->OptionsAditional['style'][] = $scrolled;
            }
            
            return '<div id="'.$this->Id.'" '.$this->getOptionsAditional().'>'.$this->html.'</div>';
        }
        
    }
    
}
?>
